﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Vita.Entities;
using Vita.Modules.BackgroundTasks;
using Vita.Modules.Party; 

namespace Vita.Modules.Calendar {

  [Entity]
  public interface ICalendar {
    [PrimaryKey, Auto]
    Guid Id { get; }

    [Auto(AutoType.CreatedOn)]
    DateTime CreatedOn { get; }
    
    [Size(Sizes.Name)]
    string Name { get; set; }

    CalendarType Type { get; set; }

    [Nullable]
    IParty Owner { get; set; } //org, group or user
  }

  [Entity]
  public interface ICalendarEvent {
    [PrimaryKey, Auto]
    Guid Id { get; }
    ICalendar Calendar { get; set; }
    DateTime StartsOn { get; set; }
    DurationType DurationType { get; set; }
    int Duration { get; set; }
    [Size(Sizes.LongName)]
    string Title { get; set; }
    [Unlimited]
    string Description { get; set; }
    CalendarEventStatus Status { get; set; }
    EventFlags Flags { get; set; }

    [Nullable]
    ICalendarEventSchedule Schedule { get; set; }
    [Nullable]
    ICalendarEvent Parent { get; set; }
  }
  

  [Entity, Unique("Calendar,Name")]
  public interface ICalendarEventSchedule {
    [PrimaryKey, Auto]
    Guid Id { get; }
    ICalendar Calendar { get; set; }
    [Auto(AutoType.CreatedOn)]
    DateTime CreatedOn { get;}
    [Auto(AutoType.CreatedById)]
    Guid CreatedById { get; set; }
    [Size(Sizes.Name)]
    string Name { get; set; }
    [Size(Sizes.LongName)]
    string Title { get; set; }
    [Unlimited]
    string Description { get; set; }

    [Nullable]
    ITaskInvocation Task { get; set;  }
    [Index]
    DateTime? ProjectedNextOn { get; set; }
    /*
    // Repeat options
    DateTime StartsOn { get; set; }
    DateTime? EndsOn { get; set; }
    RepeatType RepeatType { get; set; }
    DaySelectionType RepeatSubType { get; set; }
    int IntervalSeconds { get; set; }
    int TimeshiftMinutes { get; set; } //time shift from midnight, might be negative
    int MaxRuns { get; set; }
    WeekDays WeekdayMask { get; set; }
    int SubTypeArg { get; set; } //n to shift for selected subtype
    */
  }


}//ns
